<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$resultpage_width = $this->escape($this->params->get('resultspage_width'));
$images_path = JURI::root(false)."components/com_nrmresearch/resources/images/";

//Social shareing url
$url = 'http://'.$_SERVER["HTTP_HOST"].JRoute::_ ( 'index.php?option=com_nrmresearch&Itemid='.CURRENTRESEARCH_MENUID.'&view=currentresearch&id=', false );
$shareUrl = urlencode($url);

//For print-email action
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$app = JFactory::getApplication();
$params = $app->getParams();
$isPrint = JRequest::getVar('print',0);
//Print action icon
if($isPrint) echo JHtml::_('icon.print_screen',  $this->item, $params);



//$url = JURI::base(false)."index.php?option=com_nrmresearch&view=publication&Itemid=".PUBLICATIONS_MENUID."&id=";
$listOrder	= $this->escape($this->state->get('list.ordering'));
$listDirn	= $this->escape($this->state->get('list.direction'));

?>

<?php 
if(count($this->items)<1){
	echo "Sorry, no results were found.";
}
else{
	$count = 0;
	foreach( $this->items as $item):?>	
		<div id="result-head-<?php echo $count; ?>" class="result-head closed">
			<h3><strong><a href="<?php echo $url.$item->id;?>" ><?php echo $item->title;?></a></strong></h3>
			
			<br>
			<label><strong>Period of funding:</strong></label><label class="grey"><?php  echo $item->period_of_funding;?></label>
						
			<?php /*---------------Edit button at frontend-----------------*/
			$canEdit	= $this->user->authorise('core.edit','com_nrmresearch.'.$item->type.'.'.$item->id);
			if($canEdit):?>
			<br>
			<a target="blank" href="<?php echo JURI::root(false).'administrator/index.php?option=com_nrmresearch&view=currentproject&layout=edit&id='.$item->id;?>"><img src="<?php echo JURI::root(false);?>components/com_nrmresearch/resources/images/icon18_edit.gif" alt="edit" /></a>
			<?php endif;/*---------------Edit button at frontend-----------------*/?>
			<br><br>
			<label id="more-detail-<?php echo $count;?>" class="arrow-down more-detail">More details &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>		
		</div>
		
		<div id="result-body-<?php echo $count; ?>" class="result-body">
			<label><strong>Chief investigator/s:</strong><?php echo $item->chief_investigator;?> </label>
			<br>
			<br>
			<label><strong>Lead Organisation</strong></label>
			<p><?php echo $item->lead_organisation;?></p>
			<label><strong>Partner Organisation/s</strong></label>			
			<p><?php echo $item->partner_organisation_s;?></p>
			<label><strong>Summary of project</strong></label>			
			<p><?php echo $item->summary;?></p>
			<label><strong>Contact</strong></label>			
			<p><?php echo $item->contact;?></p>
			<p><?php echo $item->phone;?></p>
			<p><?php echo $item->email;?></p>
			<label><strong>Keywords</strong></label>			
			<p><?php echo $item->keywords;?></p>
		</div>
		
		<div id="result-foot-<?php echo $count; ?>" class="result-foot">
			<span class="sharethis">Share this article</span>
			<a href="https://twitter.com/intent/tweet?text=<?php echo $shareUrl.$item->id;?>"><img src="<?php echo $images_path;?>twitter.png" /></a>
			<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $shareUrl.$item->id;?>"><img src="<?php echo $images_path;?>face.png" /></a>
			<!--<a href="https://plus.google.com/share?url=<?php echo $shareUrl.$item->id;?>"><img src="<?php echo $images_path;?>gplus.png" /></a>
			<?php $urlIn = $shareUrl.$item->id.'&title='.$item->title;?>
			<a href="http://www.linkedin.com/shareArticle?url=<?php echo $urlIn;?>"><img src="<?php echo $images_path;?>in.png" /></a>
			<a href="http://digg.com/submit?url=<?php echo $shareUrl.$item->id;?>"><img src="<?php echo $images_path;?>digg.png" /></a>
			--><?php /*<img src="<?php echo $images_path;?>seperator.png" />*/?>
			<?php echo JHtml::_('icon.print_popup', $this->item, $params,null,$url.$item->id); ?>
			<?php echo JHtml::_('icon.email',  $this->item, $params); ?>
			
		</div>
		<div class="clear both"></div>
	<?php 
	$count++;
	endforeach;	
}
?>

<div class="paging"><?php echo $this->pagination->getPagesLinks($listOrder,$listDirn); ?></div>
<div>
	<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
</div>
<?php die;?>


